
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>

</h:head>

<h:body>
	<table border="1">
		<tr height="100">
			<td width="100" rowspan="4"></td>
			<td width="1200" valign="bottom" align="right"><h:form
					rendered="#{!myCardsBean.loggedIn}">
					<h:outputText value="#{myCardsBean.output}" id="loginOut" />
			Name:<p:inputText value="#{myCardsBean.userName}" />	
			Password:<p:password value="#{myCardsBean.password}" />
					<p:commandButton value="Login"
						actionListener="#{myCardsBean.loginUser()}" update="@all" />
					<p:commandButton value="Register" rendered="false"
						action="#{myCardsBean.registerUser()}" update="loginOut" />
				</h:form> <h:form rendered="#{myCardsBean.loggedIn}">
					<h:outputText value="#{myCardsBean.output}" />
			Logged in as user:<p:outputLabel value="#{myCardsBean.userName}" />
					<p:commandButton value="Logout"
						action="#{myCardsBean.logoutUser()}" update="@all" />
				</h:form></td>
			<td width="100" rowspan="4"></td>
		</tr>
		<tr height="400">
			<td valign="top">
				<table border="1">
					<tr>
						<td width="1200"><h:form>
								<p:tabMenu activeIndex="#{myCardsBean.selectedPage}">
									<p:menuitem value="Home" action="#{myCardsBean.selectPage(0)}"
										icon="ui-icon-home" />
									<p:menuitem value="Game" action="#{myCardsBean.selectPage(1)}"
										icon="ui-icon-star"  rendered="#{myCardsBean.userIsAdmin}" />
									<p:menuitem value="Cards" action="#{myCardsBean.selectPage(2)}"
										icon="ui-icon-folder-collapsed" rendered="#{myCardsBean.userIsAdmin}" />
									<p:menuitem value="AdminDecks"
										action="#{myCardsBean.selectPage(3)}" icon="ui-icon-wrench"
										rendered="#{myCardsBean.userIsAdmin}" />
									<p:menuitem value="AdminCards"
										action="#{myCardsBean.selectPage(4)}" icon="ui-icon-wrench"
										rendered="#{myCardsBean.userIsAdmin}" />
									<p:menuitem value="AdminActions"
										action="#{myCardsBean.selectPage(5)}" icon="ui-icon-wrench"
										rendered="#{myCardsBean.userIsAdmin}" />
									<p:menuitem value="AdminPage"
										action="#{myCardsBean.selectPage(6)}" icon="ui-icon-wrench"
										rendered="#{myCardsBean.userIsAdmin}" />
								</p:tabMenu>
							</h:form></td>
					</tr>
					<tr height="600" valign="top">
						<td><ui:insert name="main" /></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr height="100">
			<td></td>
		</tr>


	</table>







</h:body>
</html>
